package com.scedu.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class ApplicationContextConfig {
    @Bean //注入RestTemplate 到spring
    @LoadBalanced //赋予RestTemplate负载均衡的能力,通过微服务名称直接调用微服务
    public RestTemplate getRestTemplate(){
        return  new RestTemplate();
    }
}
